package com.panasonic.web.service.impl;

import com.panasonic.web.domain.cms.CmsAttachment;
import com.panasonic.web.mapper.CmsAttachmentMapper;
import com.panasonic.web.service.ICmsAttachmentService;
import com.panasonic.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 附件Service业务层处理
 * 
 * @author lwf
 * @date 2021-11-12
 */
@Service
public class CmsAttachmentServiceImpl implements ICmsAttachmentService 
{
    @Autowired
    private CmsAttachmentMapper cmsAttachmentMapper;

    /**
     * 查询附件
     * 
     * @param id 附件ID
     * @return 附件
     */
    @Override
    public CmsAttachment selectCmsAttachmentById(Long id)
    {
        return cmsAttachmentMapper.selectCmsAttachmentById(id);
    }

    /**
     * 查询附件列表
     * 
     * @param cmsAttachment 附件
     * @return 附件
     */
    @Override
    public List<CmsAttachment> selectCmsAttachmentList(CmsAttachment cmsAttachment)
    {
        return cmsAttachmentMapper.selectCmsAttachmentList(cmsAttachment);
    }

    /**
     * 新增附件
     * 
     * @param cmsAttachment 附件
     * @return 结果
     */
    @Override
    public int insertCmsAttachment(CmsAttachment cmsAttachment)
    {
        cmsAttachment.setCreateTime(DateUtils.getNowDate());
        return cmsAttachmentMapper.insertCmsAttachment(cmsAttachment);
    }

    /**
     * 修改附件
     * 
     * @param cmsAttachment 附件
     * @return 结果
     */
    @Override
    public int updateCmsAttachment(CmsAttachment cmsAttachment)
    {
        return cmsAttachmentMapper.updateCmsAttachment(cmsAttachment);
    }

    /**
     * 批量删除附件
     * 
     * @param ids 需要删除的附件ID
     * @return 结果
     */
    @Override
    public int deleteCmsAttachmentByIds(Long[] ids)
    {
        return cmsAttachmentMapper.deleteCmsAttachmentByIds(ids);
    }

    /**
     * 删除附件信息
     * 
     * @param id 附件ID
     * @return 结果
     */
    @Override
    public int deleteCmsAttachmentById(Long id)
    {
        return cmsAttachmentMapper.deleteCmsAttachmentById(id);
    }
}
